<?php header("Content-Type:text/html;   charset=utf-8"); ?>
<script type="text/javascript">
var curtypeUserImg = "1";
$(function(){
    $("a[href='#maximize']").trigger("click");
    $("#btnSubmitPicImg").bind("click",btnSubmitPicImg);
    loadNewPic();
});

function btnSubmitPicImg()
{
    $.ajax({
        type:"post",
        url:"admin.php/advertise/addPic",
        dataType:"json",
        data:$('#formUserImg').serialize(),
        success:function(data){
            alert("提交成功");
            $("#btnClosePicImg").trigger("click");
        }
    });
}

function loadNewPic()
{
    var idhid = $('#idhid').val();
    if(idhid==null)
        return ;

    $.ajax({
        type:"post",
        url:"admin.php/advertise/loadPic",
        dataType:"html",
        data:{id:idhid},
        success:function(data){
            $(".tableNewPic").html(data);
        }
    });
}

function delButton(obj)
{

    $(obj).parent().parent().remove();
}
<?php $timestamp = time();?>
$(function() {
    $('#file_upload').uploadify({
        'formData'     : {
            'timestamp' : '<?php echo $timestamp;?>',
            'token'     : '<?php echo md5('unique_salt' . $timestamp);?>'
        },
        'swf'      : 'uploadify/uploadify.swf',
        'uploader' : '<?php echo base_url();?>uploadify/uploadify.php',
        'buttonImage': 'images/sczp_inp.jpg',
        'onUploadSuccess' : function(file, data, response) {
            var aa='';
            if(response!=0){
                aa = '<tr><td>排序：</td><td style="vertical-align: middle; line-height: 130px; clear: both; width: 30px;padding: 30px;">' +
                    '<input type="text" style="clear: both" name="sort[]"></td><td>url:</td><td><input type="text" value="" name="url" /></td><td style="text-align: left"><input type="hidden" value="'+data+'" name="picpath[]">' +
                    '<img style="width: 100px; height: 100px; vertical-align: middle; cursor: pointer" src="<?php echo base_url();?>uploads/'+data+'">' +
                    '<input type="button" onclick="delButton(this)" value="删除" tyle="width: 80px"></td></tr>';
            }
            $(".tableNewPic").append(aa);
        }
    });
});
</script>
<style type="text/css">
    .uploadify-button {
        background-color: transparent;
        border: none;
        padding: 0;
    }
    .uploadify:hover .uploadify-button {
        background-color: transparent;
    }
    #file_upload{margin-top: -5px;float: left;}
</style>
<div class="pageContent">
    <form id="formUserImg" class="pageForm required-validate" action="" method="post" enctype="multipart/form-data">
        <div class="pageFormContent" style="width: 98%;" layoutH="56">
            <div id="queue"></div>
                <input id="file_upload" name="file_upload" type="file" multiple="true">
            <table class="tableNewPic" style="margin-top:50px;">
                <tr>
                    <td colspan="4" style='line-height: 40px'>&nbsp;&nbsp;</td>
                </tr>
            </table>

            <input type="hidden" id="idhid" name="id" value="<?php echo $_GET['id'];?>" />
            <div class="buttonActive" style="width: 120px; margin-left: 50px;">
                <div class="buttonContent">
                    <button id="btnSubmitPicImg" type="button" style="width: 80px">提 交</button>
                </div>
            </div>

            <div class="button" style="text-align: right">
                <div class="buttonContent" style="text-align: right">
                    <button id="btnClosePicImg" type="button" class="close"
                            style="width: 80px">关 闭</button>
                </div>
            </div>
        </div>
    </form>
</div>
